<?php
namespace tool;
use app\model\UserToken;
use support\think\Cache;
use think\facade\Db;
/**
 *
 */
class ThRedis
{
    //查找所有文件夹内文件
    public static function clearRedisPrefix($prefix = ''){
        if(!$prefix){
            return ['code'=>0,'msg'=>'前缀不能为空！'];
        }
        $redis = Cache::store('redis')->handler();
        $allKeys = $redis->keys('*');

        foreach ($allKeys as $key) {
            if (strpos($key, $prefix) === 0) {
                $redis->del($key);
            }
        }

        return ['code'=>1,'msg'=>'清除成功！'];
    }


}